package com.erplan.studentmgt.desktop.elements;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MenuAdapter;
import org.eclipse.swt.events.MenuEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;

import com.erplan.studentmgt.desktop.StudentMgt;

public class AppPopupMenu {

	public static void init(){
		StudentMgt.popupMenu = new Menu(StudentMgt.shell, SWT.POP_UP);
		final MenuItem copyItem = new MenuItem(StudentMgt.popupMenu, SWT.PUSH);

		final MenuItem refreshItem = new MenuItem(StudentMgt.popupMenu, SWT.PUSH);
		final MenuItem removeItem = new MenuItem(StudentMgt.popupMenu, SWT.PUSH);
		final MenuItem pasteItem1 = new MenuItem(StudentMgt.popupMenu, SWT.PUSH);

		refreshItem.setText("Refresh");
		removeItem.setText("Remove");
		pasteItem1.setText("Paste");

		StudentMgt.popupMenu.addMenuListener(new MenuAdapter() {
			public void menuShown(MenuEvent e) {
				System.out.println("Menu event");
			}
		});
		copyItem.setText("Copy");
		copyItem.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				System.out.println("copy");
			}
		});
	}
}